﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Oliving.Edge.IServices;
using Oliving.Edge.Model;
using Oliving.Edge.Model.Models.SystemBase;

namespace Oliving.Edge.Controllers.SystemBase
{

    [Route("api/[controller]/[action]")]
    [ApiController]
    //[Authorize(Permissions.Name)]

    public class SysDeptController : ControllerBase
    {




        #region 构造函数

        private readonly ISys_DepartmentServices _ISys_DepartmentServices;

        public SysDeptController(
         ISys_DepartmentServices Sys_DepartmentServices)
        {
            _ISys_DepartmentServices = Sys_DepartmentServices;
        }

        #endregion


        // GET: api/User/5
        [HttpGet()]
        public async Task<MessageModel<List<SysDepartmentModel>>> Get()
        {
            var data = new MessageModel<List<SysDepartmentModel>>();

            // 测试 AOP 缓存
            List<SysDepartmentModel> clist = await _ISys_DepartmentServices.Query();
            data.response = clist;
            data.msg = "获取成功！";
            data.success = true;


            return data;
            
        }


        // GET: api/User/5
        [HttpGet("{id}")]
        public string Get(string id)
        {
            return "value";
        }
    }
}